import { get, post, postFormData } from '@/request/http'
import store from '@/store'

//市 接口

// 列表数据接口
export const goodsBrandList = (data) =>
  post(
    '/FTKJWLHYPT/base/goodsBrandList',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            brandName: data.brandName,
            dptId: store.state.user.DPTID_DX_H == null ? -1 : store.state.user.DPTID_DX_H,
            fltId: store.state.user.FLT_UUID_DX_H,
          }
        },
        PageIndex: {
          FTKJWLHYPT: data.PageIndex
        },
        PageSize: {
          FTKJWLHYPT: data.PageSize
        }
      }
    }
  )
//新增
export const addGoodsBrand = (data) =>
  post(
    '/FTKJWLHYPT/base/addGoodsBrand',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            creator: store.state.user.USR_CODE_DX_H,
            dptId: store.state.user.DPTID_DX_H,
            fltId: store.state.user.FLT_UUID_DX_H,
            brandName: data.brandName,
            brandCode: data.brandCode,
            remarks: data.remarks,
            isdefault: data.isdefault,
            iseffective: data.iseffective,
          }
        },
      }
    }
  )

//编辑
export const editGoodsBrand = (data) =>
  post(
    '/FTKJWLHYPT/base/editGoodsBrand',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            lastmodifier: store.state.user.USR_CODE_DX_H,
            dptId: store.state.user.DPTID_DX_H,
            fltId: store.state.user.FLT_UUID_DX_H,
            brandName: data.brandName,
            brandCode: data.brandCode,
            remarks: data.remarks,
            isdefault: data.isdefault,
            iseffective: data.iseffective,
            brandId: data.brandId,
            // isdel:data.isdel,
          }
        },
      }
    }
  )
//删除
export const deleteGoodsBrand = (data) =>
  post(
    '/FTKJWLHYPT/base/deleteGoodsBrand',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            brandId: data.brandId,
          }
        },
      }
    }
  )
//查询货物品牌代码
export const queryNewGoodsBrand = () =>
  post(
    '/FTKJWLHYPT/base/queryNewGoodsBrands',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {}
        },
      }
    }
  )
//下载货物品牌导入模板
export const importTemplate = () =>
  get(
    '/FTKJWLHYPT/base/DownLoadImportTemplate',
    {}
  )
export const importGoodsBrandSer = (file) => {
  let formData = new FormData()
  formData.append('excel', file)
  formData.append('type', 'goodsBrand')
  return postFormData('/FTKJWLHYPT/base/importGoodsBrand', formData)
}

